Repository navigation
PP-6: RunInputs and testing.make_clean_run - #112
Merged
Merged
Conversation
PP-5 plus PP-4's latest, so PP-6 builds on both; PP-5's branch itself is left to its reviewer. Conflict in docs/contract.md: the error row gains both axes_x_before_y and image_named_as_mask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
RunInputs refuses v1 manifests, a changed table or design, and changed images (at open and at every read); reads planes, lazy images and masks by the recorded pairing with the label check; pickles. testing.make_clean_run builds a tiny clean run for the bricks' tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
The only conflict was the error row of docs/contract.md: main's row is a superset of this branch's (it lists image_named_as_mask with PP-5's mask errors), so main's row is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
…ks on open RunInputs.read_mask took a mask's stored axes from the file's header as read now and ignored the manifest's "axes" (the stored axes recorded since 3b572ca). It now reads through the recorded axes and roles, and refuses a mask whose header no longer gives the recorded axes or shape. RunInputs.open checked only the images' fingerprints; design §6 says each file is checked when the run is opened. It now checks every recorded mask too, and the message names masks_root= (experiment_root= for images) for files that were only moved. make_clean_run gets design=True (a confirmed design, ctrl the control), so bricks can test runs with experiment_design.csv. New tests: design() of a run with a design, a changed or missing design, spawned worker processes reading planes and masks, a header naming X before Y read Y before X (owner rule), TZCYX from a ZTCYX file, a stated plain-stack mask read through its stored axes, a mask stored otherwise than recorded, a mask changed or moved before opening, and OME-Zarr label images. Contract §9.1 lists these and the canonical-order rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
Design v0.4 §6: every v1 run must be redone, and RunInputs refuses v1 manifests; check_sources still accepted them. It now fails every image with the single error manifest_before_v040. Extracting the issue builder brings check_sources under the complexity limit, so its C901 noqa goes (the noqa baseline shrinks from 2 to 1). Masks are not added to check_sources: RunInputs checks them on open and on every read, and file runs read through RunInputs from v0.4.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
guijacquemet
marked this pull request as ready for review
November 1, 2026 18:21
Contributor
Author
|
Independent review of PP-6 (design v0.4 §6, §8, §9, and the change log). Brought up to date: merged main after PP-4 and PP-5 ( Findings, fixed:
Verified:
Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PP-6 of the v0.4.0 plan (design v0.4 §6). Based on main: PP-4 (#110) and PP-5 (#111) are merged, and main was merged in (
de835c5).Commits
c44798cmerges PP-4's latest commits into the old PP-5 tip (history from when this PR was stacked).21e44bcand1023830addRunInputs,testing.make_clean_run, the contract tests and contract §9.1.de835c5merges main (PP-4 and PP-5 with their review fixes). The only conflict was the error row ofdocs/contract.md; main's row is a superset and was kept.973c4ca(review):read_maskreads through the mask's recorded stored axes and roles;openchecks every mask's fingerprint too;make_clean_run(design=True); more contract tests.41b0d73(review):check_sourcesrefuses a version 1 manifest (manifest_before_v040).What it adds
RunInputs.open(output, experiment_root=None, masks_root=None)in the new modulerun_inputs.py(io layer). It refuses withRunInputsErrorwhen:plane_histograms.csvorexperiment_design.csvis not the manifest's;experiment_root=ormasks_root=for files that were only moved.It checks the fingerprint again on every read. The table is read once, when the run is opened, and kept as a snapshot.
It gives:
fovs():Fovrecords with the FOV key,plane_ids, axes, roles,axes_from, channel names, dtype,significant_bits, and the Z/T/C counts. They come from the manifest and the table; nothing is parsed from names.pixel_sizes(fov): value, unit and source for each role.read_plane(fov, z, t): a CYX array of the stored values.read_image(fov): a lazy TZCYXLazyImage.ZCXY) is returned Y before X. Nothing else is reordered.mask_types().read_mask(fov, type, z, t): uses the recorded pairing only. It reads the mask as stored, through the manifest'saxes(stored, for exampleIYX) androles(for exampleTYX), with preprocessing's reader, which runscheck_labels. It refuses a mask that changed since the run, or whose header no longer gives the recorded axes or shape. A stated shared 2-D mask is returned for any plane.histograms(),design()andimage_type().A
RunInputscan be pickled and used in worker processes; a test uses multiprocessingspawn.morphobricks_preprocessing.testing.make_clean_run(folder, *, axes, shape, mask_types, pixel_size, design, seed)writes a two-condition experiment of named-axis OME-TIFFs, with optional masks and an optional confirmed design, runs preprocessing on it, and returns aCleanRun(experiment, output, masks, result).check_sourcesnow fails every image with the single errormanifest_before_v040when the manifest is version 1 (design §6: every v1 run is redone). It does not check masks;RunInputschecks them on open and on every read.RunInputs,RunInputsError,FovandLazyImageare exported.docs/contract.mdgets a new §9.1, and the user guide lists the new code.Tests
tests/test_run_inputs.pyhas 23 contract tests, andtests/test_check_sources.pyhas one new test.None of the
RunInputstests can pass on main, becauseRunInputsdoesn't exist there; collection fails with an ImportError.Against the PR before review (
de835c5), 5 of the review's new tests fail:check_sources.The others pass there; they add coverage of behaviour that was already right:
Gate (at
41b0d73)ruff checkandruff format --checkpass, and so doestools/check.py --rules.C901noqa count went from 2 to 1.After this PR the owner tags v0.4.0rc1 (design §8).
https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
Generated by Claude Code